<!DOCTYPE html>
<html lang="en">
<head>
	<title></title>
	<meta charset="UTF-8"/>
	<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
	<link rel="stylesheet" href="__PUBLIC__/Admin/css/bootstrap.min.css?v={#$Think.config.ADMIN_VERSION_VAL}"/>
	<link rel="stylesheet" href="__PUBLIC__/Admin/css/bootstrap-responsive.min.css?v={#$Think.config.ADMIN_VERSION_VAL}"/>
	<link rel="stylesheet" href="__PUBLIC__/Admin/css/uniform.css?v={#$Think.config.ADMIN_VERSION_VAL}"/>
	<link rel="stylesheet" href="__PUBLIC__/Admin/css/matrix-style2.css?v={#$Think.config.ADMIN_VERSION_VAL}"/>
	<link rel="stylesheet" href="__PUBLIC__/Admin/css/matrix-media.css?v={#$Think.config.ADMIN_VERSION_VAL}"/>
	<link rel="stylesheet" href="__PUBLIC__/Admin/font-awesome/css/font-awesome.css?v={#$Think.config.ADMIN_VERSION_VAL}"/>
	<link rel="stylesheet" href="__PUBLIC__/Admin/css/changyun.css?v={#$Think.config.ADMIN_VERSION_VAL}"/>
	<style>
		.table th, .table td {
			line-height: 20px;
			text-align: center;
			border-top: 1px solid #ddd;
			padding: 5px 0 5px 10px;
			vertical-align: middle;
		}
	</style>
</head>
<body>
<div id="content">
	<include file="Public/maintop"/>
	<div class="container-fluid">
		<div class="row-fluid">
			<div class="span12">
				<div class="widget-box">
					<div class="cyz-m-tab">
						<ul class="cyz-m-tab-title">
							<li class="cyz-m-this" href="javascript:void(0);">名片管理</li>
						</ul>
					</div>
					<div class="widget-content" style="padding:5px;border:0px;">
						<!--						<div class="fl table-button">-->
						<!--							<div class="btn-group">-->
						<!--								<a href="{#:U('edit')}" class="btn btn-success"><i class="icon-plus"></i> 新增名片</a>-->
						<!--								<a href="javascript:void(0);" onclick="addMore()" class="btn btn-primary"><i class="icon-upload"></i> 批量新增</a>-->
						<!--								<a href="javascript:void(0);" onclick="actionGoods()" class="btn btn-danger"><i class="icon-remove"></i> 批量删除</a>-->

						<!--							</div>-->
						<!--						</div>-->
						<form action="__ACTION__" method="get">
							<div class="table-button" id="city_4">
								<div class="fr table-button">
									<button type="submit" id="search" class="btn btn-success" style="margin-bottom: 10px;">
										<i class="icon-search"></i> 搜索
									</button>
									<a type="button" class="btn btn-primary" style="margin-bottom: 10px;" onclick="importExcel()"><i class="icon-cloud-download"></i> 导出Excel</a>

								</div>
								<div class="fr table-button">
									<input type="text" name="name" placeholder="请输入姓名或手机号码" value="{#$getting.name}">
								</div>
							</div>
						</form>
					</div>
					<div class="widget-content" style="padding:5px;">
						<table class="table table-bordered table-striped with-check">
							<thead>
							<tr>
								<th width="80">ID</th>
								<th>姓名</th>
								<th>联系电话</th>
								<th>微信号</th>
								<th>标签</th>
								<th>微信二维码</th>
								<th>地址</th>
								<th>添加时间</th>
								<th>广场展示</th>
								<th>名片展示</th>
								<th>主页访问</th>
								<th>操作</th>
							</tr>
							</thead>
							<tbody>
							<notempty name="list_data.list_data">
								<volist name="list_data.list_data" id="admin">
									<form method="post">
										<tr>
											<td>
												{#$admin.id}
											</td>
											<td style="text-align: center;">
												{#$admin.c_cn_true_name}
											</td>
											<td style="text-align: center;">
												{#$admin.c_phone}
											</td>
											<td style="text-align: center;">
												{#$admin.c_weixin}
											</td>
											<td style="text-align: left;">
												<volist name="admin.zhiye_label" id="label">
													<a href="javascript:void(0);" class="btn btn-mini btn-success" style="margin-left: 10px">{#$label}</a>
												</volist>
											</td>
											<td style="text-align: center;">
												<neq name="admin.c_weixin_img" value="">
													<a href="{#$admin.c_weixin_img}" target="_blank"><img src="{#$admin.c_weixin_img}" style="width: 50px;height: 50px;"/></a>
												</neq>
												<eq name="admin.c_weixin_img" value="">
													--
												</eq>
											</td>
											<td style="text-align: left">{#$admin.c_address}</td>
											<td>{#$admin.created_at}</td>
											<td>{#$admin.square_is_show_title}</td>
											<td>{#$admin.all_view_person}人</td>
											<td>{#$admin.created_at}</td>
											<td style="width:220px;">
												<input type="hidden" name="id" value="{#$admin.id}"/>
												<if condition="$admin.card_status ==1">
													<a href="javascript:void(0);" onclick="updateStatus({#$admin['id']},'card_status',0,'隐藏操作')" class="btn btn-mini btn-danger"><i class="icon-cog"></i> 隐藏操作</a>
													<else/>
													<a href="javascript:void(0);" onclick="updateStatus({#$admin['id']},'card_status',1,'显示操作')" class="btn btn-mini btn-success"><i class="icon-cog"></i> 显示操作</a>
												</if>
												<a title="详情" href="{#:U('edit?id='.$admin['id'])}" class="btn btn-mini btn-success"><i class="icon-pencil"></i> 详情</a>
												<!--												<a title="删除" href="javascript:void(0);" onclick="dodel('{#:U('del?id='.$admin['id'])}')" class="btn btn-mini btn-danger"><i class="icon-remove"></i> 删除</a>-->
											</td>
										</tr>
									</form>
								</volist>
								<else/>
								<td colspan="11" class="text-center"> 暂时还没有数据!</td>
							</notempty>
							</tbody>
						</table>

						<div id="hongxin_page_view">{#$list_data._page}</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>
<script src="__PUBLIC__/Admin/js/jquery.min.js"></script>
<script src="__PUBLIC__/Admin/js/jquery.ui.custom.js"></script>
<script src="__PUBLIC__/Admin/js/bootstrap.min.js"></script>
<script src="__PUBLIC__/Admin/js/jquery.uniform.js"></script>
<script src="__PUBLIC__/Admin/js/matrix.js"></script>
<script src="__PUBLIC__/Admin/js/matrix.tables.js"></script>
<script src="__PUBLIC__/js/layer/layer.js"></script>
<script src="__PUBLIC__/Admin/js/common.js"></script>
<script>

function updateStatus(id, faild, status, message) {
	layer.confirm('确定要更新状态为' + message + '吗', {
		title: '提示',
		icon: 0,
		btn: ['确定', '取消'] //按钮
	}, function(e) {
		layer.close(e);
		var loadi = null;
		loadi = layer.load(2);
		$.ajax({
			type: "GET",
			data: {aid: id, field: faild, status: status, _: Date.now()},
			dataType: "json",
			url: "{#:U('setStatus')}",
			success: function(rdata) {
				layer.close(e);
				layer.close(loadi);
				if (rdata.status == 1) {
					layer.alert(rdata.msg, {icon: 1}, function() {
						window.location.reload();
					});
					return false;
				} else {
					layer.alert(rdata.msg, {icon: 0});
					return false;
				}
			}
		});
	}, function(e) {
		layer.close(e);
	});
}

function importExcel() {
	var l_layer = layer.msg('导出中，请稍候', {
		icon: 16,
		shade: 0.5
	});
	var url = "{#:U('Card/dataImport')}";
	var btnSearch = $("#search"), form = btnSearch.closest('form');
	var param = form.serialize();
	url = url.indexOf("?") != -1 ? url + "&" + param : url + "?" + param;
	window.location.href = url;
	l_layer.close();
}

function actionGoods() {
	var gid = '';
	$.each($("input[name='check_id']"), function() {
		if (this.checked) {
			gid = gid + $(this).val() + ',';
		}
	});
	if (gid == '') {
		layer.alert('请先选择要操作的名片', {icon: 0});
		return false;
	}
	layer.confirm('确定要进行该操作吗', {
		title: '提示',
		icon: 0,
		btn: ['确定', '取消'] //按钮
	}, function(e) {
		var loadi = null;
		loadi = layer.load(2);
		$.ajax({
			type: "GET",
			data: {ids: gid, _: Date.now()},
			dataType: "json",
			url: "{#:U('actionAllCard')}",
			success: function(rdata) {
				layer.close(e);
				layer.close(loadi);
				if (rdata.status == 1) {
					layer.alert(rdata.msg, {icon: 1}, function() {
						window.location.reload();
					});
					return false;
				} else {
					layer.alert(rdata.msg, {icon: 0});
					return false;
				}
			}
		});
	}, function(e) {
		layer.close(e);
	});
}

function addMore() {
	layer.open({
		type: 2,
		title: '批量新增',
		area: ['800px', '450px'], //宽高
		shade: 0.3,
		content: "/Manage.php/Card/addMore"
	});
}

function dodel(jump_url) {
	layer.confirm('确定要删除吗', {
		title: '提示',
		icon: 0,
		btn: ['确定', '取消'] //按钮
	}, function(e) {
		window.location.href = jump_url;
		layer.close(e);
	}, function(e) {
		layer.close(e);
	});
}

function get_rcode_info(url) {
	layer.open({
		type: 2,
		offset: '100px',
		title: '二维码',
		area: ['460px', '490px'],
		content: url,
		success: function(layero, index) {
			//layer.iframeAuto(index);
		}
	});
}

function changstatus(field, status, aid, e) {
	var loadi = null;
	loadi = layer.load(2);
	$.ajax({
		type: "GET",
		url: "__CONTROLLER__/setstatus",
		data: {field: field, status: status, aid: aid},
		dataType: "html",
		success: function(data) {
			layer.close(loadi);
			$(e).parent("td").html(data);
		},
		error: function(XMLHttpRequest, textStatus, errorThrown) {

		}
	});
}
</script>
<script>
var city_js_root = "__PUBLIC__/js/citySelect/";
</script>
<script type="text/javascript" src="__PUBLIC__/js/citySelect/jquery.cityselect.js"></script>
<script>
$("#city_4").citySelect({
	prov: "{#$getting.u_province}",
	city: "{#$getting.u_city}",
	dist: "{#$getting.u_district}",
	required: false
});
</script>
</body>
</html>
